import Vue from 'vue';
import 'normalize.css';
import ElementUI from 'element-ui';
import '@/assets/style/element.scss';
import '@/assets/style/common.scss';
import App from './App.vue';
import router from './router';
import './permission';
import store from './store';
import Icons from './icons';
import Chart from './plugins/chart';
import Dayjs from './plugins/dayjs';
import Pinyin from './plugins/pinyin';
import ClickOutside from './plugins/click-outside';
import DialogDraggable from './plugins/dialog-draggable';
import { ORIGINAL_THEME_COLOR } from './utils';

// 确保每次更新包都能清空缓存
const VERSION = store.state.version;
const oldVersion = localStorage.getItem('version');
if (oldVersion !== VERSION) {
  localStorage.clear();
}
localStorage.setItem('version', VERSION);
console.info('%c version: ' + VERSION, 'color: ' + ORIGINAL_THEME_COLOR);

Vue.config.productionTip = false;
Vue.use(ElementUI, {
  size: 'small'
});
Vue.use(Icons);
Vue.use(Chart);
Vue.use(Dayjs);
Vue.use(Pinyin);
Vue.use(ClickOutside);
Vue.use(DialogDraggable);

Vue.prototype.$EventBus = new Vue({});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app');
